/*
 * 文件名：UserDaoImp.java
 * 版权：Copyright by www.wootide.com
 * 描述：
 * 修改人：ozm
 * 修改时间：2013-1-24
 * 跟踪单号：
 * 修改单号：
 * 修改内容：
 */
package com.wootide.cms.service.facility.device.dao.imp;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.wootide.cms.log.syslog.RunLog;
import com.wootide.cms.service.facility.device.dao.DeviceInfoDao;
import com.wootide.cms.service.facility.device.pojo.DeviceInfo;

public class DeviceInfoDaoImp extends HibernateDaoSupport implements DeviceInfoDao
{
    
    private RunLog runLog;
    
    @Override
    public DeviceInfo findDeviceInfoById(Integer deviceId)
    {
        runLog.debug("deviceId=" + deviceId);
        
        return getHibernateTemplate().get(DeviceInfo.class, deviceId);
    }
    
    @Override
    public int findNumByDeviceInfoNum(int deviceNum)
    {
        try
        {
            runLog.debug("deviceNum=" + deviceNum);
            
            return ((Number)getHibernateTemplate().findByNamedQuery("findDeviceInfoNumByNum",
                    deviceNum)
                    .get(0)).intValue();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        return 0;
        
    }
    
    public RunLog getRunLog()
    {
        return runLog;
    }
    
    public void setRunLog(RunLog runLog)
    {
        this.runLog = runLog;
    }
}
